package com.ruoyi.crm.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.crm.domain.SysProvider;
import com.ruoyi.crm.mapper.SysProviderMapper;
import com.ruoyi.crm.service.ISysProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 供货商Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-12-11
 */
@Service
public class SysProviderServiceImpl implements ISysProviderService
{
    @Autowired
    private SysProviderMapper sysProviderMapper;

    /**
     * 查询供货商
     * 
     * @param id 供货商主键
     * @return 供货商
     */
    @Override
    public SysProvider selectSysProviderById(Long id)
    {
        return sysProviderMapper.selectSysProviderById(id);
    }

    /**
     * 查询供货商列表
     * 
     * @param sysProvider 供货商
     * @return 供货商
     */
    @Override
    public List<SysProvider> selectSysProviderList(SysProvider sysProvider)
    {
        return sysProviderMapper.selectSysProviderList(sysProvider);
    }

    /**
     * 新增供货商
     * 
     * @param sysProvider 供货商
     * @return 结果
     */
    @Override
    public int insertSysProvider(SysProvider sysProvider)
    {
        sysProvider.setCreateTime(DateUtils.getNowDate());
        return sysProviderMapper.insertSysProvider(sysProvider);
    }

    /**
     * 修改供货商
     * 
     * @param sysProvider 供货商
     * @return 结果
     */
    @Override
    public int updateSysProvider(SysProvider sysProvider)
    {
        sysProvider.setUpdateTime(DateUtils.getNowDate());
        return sysProviderMapper.updateSysProvider(sysProvider);
    }

    /**
     * 批量删除供货商
     * 
     * @param ids 需要删除的供货商主键
     * @return 结果
     */
    @Override
    public int deleteSysProviderByIds(Long[] ids)
    {
        return sysProviderMapper.deleteSysProviderByIds(ids);
    }

    /**
     * 删除供货商信息
     * 
     * @param id 供货商主键
     * @return 结果
     */
    @Override
    public int deleteSysProviderById(Long id)
    {
        return sysProviderMapper.deleteSysProviderById(id);
    }
}
